
#include "stdtypedef.h"
#include "app_ticks.h"


extern union{
    struct{
        T_UBYTE     ALL;
    }by;
    struct{
        T_UBYTE     _1TCK   :1;
        T_UBYTE     _5TCK   :1;
        T_UBYTE     _10TCK  :1;
        T_UBYTE     _20TCK  :1;
        T_UBYTE     _200TCK :1;
        T_UBYTE     _1kTCK  :1;

        T_UBYTE     NEWTCK  :1;
    }bi;
}rs_TckFlags;

void CheckTicks(void){
    extern T_UWORD    ruw_TickCounter;
    /*
    extern T_UBYTE    rub_NewTickFlag,
                      rub_Task_Tck_Exec_Flag,
                      rub_Task_5Tck_Exec_Flag,
                      rub_Task_10Tck_Exec_Flag,
                      rub_Task_20Tck_Exec_Flag,
                      rub_Task_200Tck_Exec_Flag,
                      rub_Task_1kTck_Exec_Flag;
     */
    
    if(rs_TckFlags.bi.NEWTCK){
        rs_TckFlags.bi.NEWTCK = 0;
        if(!(ruw_TickCounter % 1)&& (ruw_TickCounter > 0)){
            rs_TckFlags.bi._1TCK = 1;
        }
        if(!(ruw_TickCounter % 5)&& (ruw_TickCounter > 0)){
            rs_TckFlags.bi._5TCK = 1;
        }
        if(!(ruw_TickCounter % 10)&& (ruw_TickCounter > 0)){
            rs_TckFlags.bi._10TCK = 1;
        }
        if(!(ruw_TickCounter % 20)&& (ruw_TickCounter > 0)){
            rs_TckFlags.bi._20TCK = 1;
        }
        if(!(ruw_TickCounter % 200)&& (ruw_TickCounter > 0)){
            rs_TckFlags.bi._200TCK = 1;
        }
        if(!(ruw_TickCounter % 1000)&& (ruw_TickCounter > 0)){
            rs_TckFlags.bi._1kTCK = 1;
        }
    }
}